package com.talkweb.osmharmony.views.overlay;

import com.talkweb.osmharmony.api.IMapView;
import com.talkweb.osmharmony.views.MapView;
import com.talkweb.osmharmony.views.Projection;
import com.talkweb.osmharmony.views.drawing.MapSnapshot;
import ohos.agp.render.Canvas;
import ohos.agp.utils.Point;
import ohos.multimodalinput.event.KeyEvent;
import ohos.multimodalinput.event.TouchEvent;

import java.util.List;

public interface OverlayManager extends List<Overlay> {
    Overlay get(int pIndex);

    int size();

    void add(int pIndex, Overlay pElement);

    Overlay remove(int pIndex);

    Overlay set(int pIndex, Overlay pElement);

    /**
     * Gets the optional TilesOverlay class.
     *
     * @return the tilesOverlay
     */
    TilesOverlay getTilesOverlay();

    /**
     * Sets the optional TilesOverlay class. If set, this overlay will be drawn before all other
     * overlays and will not be included in the editable list of overlays and can't be cleared
     * except by a subsequent call to setTilesOverlay().
     *
     * @param tilesOverlay the tilesOverlay to set
     */
    void setTilesOverlay(TilesOverlay tilesOverlay);

    List<Overlay> overlays();

    Iterable<Overlay> overlaysReversed();

    /**
     * If possible, use {@link #onDraw(Canvas, Projection)} instead (cf. {@link MapSnapshot}
     */
    void onDraw(Canvas c, MapView pMapView);

    /**
     * @since 6.1.0
     */
    void onDraw(Canvas c, Projection pProjection);

    void onDetach(MapView pMapView);

    boolean onKeyDown(int keyCode, KeyEvent event, MapView pMapView);

    boolean onKeyUp(int keyCode, KeyEvent event, MapView pMapView);

    boolean onTouchEvent(TouchEvent event, MapView pMapView);

    boolean onSnapToItem(int x, int y, Point snapPoint, IMapView pMapView);

    boolean onDoubleTap(TouchEvent e, MapView pMapView);

    boolean onSingleTapConfirmed(TouchEvent e, MapView pMapView);

    boolean onDown(TouchEvent pEvent1, MapView pMapView);

    boolean onFling(TouchEvent pEvent1, TouchEvent pEvent2,
                    float pVelocityX, float pVelocityY, MapView pMapView);

    boolean onLongPress(TouchEvent pEvent, MapView pMapView);

    boolean onScroll(TouchEvent pEvent1, TouchEvent pEvent2,
                     float pDistanceX, float pDistanceY, MapView pMapView);


    void setOptionsMenusEnabled(boolean pEnabled);

//    boolean onCreateOptionsMenu(Menu pMenu, int menuIdOffset, MapView mapView);
//
//    boolean onPrepareOptionsMenu(Menu pMenu, int menuIdOffset, MapView mapView);
//
//    boolean onOptionsItemSelected(MenuItem item, int menuIdOffset, MapView mapView);

    /**
     * @since 6.0.0
     */
    void onPause();

    /**
     * @since 6.0.0
     */
    void onResume();

}
